<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>编辑危险源</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
</head>

<body>

    <div class="layui-card layadmin-header" style="display:block">
        <div class="layui-breadcrumb" lay-filter="breadcrumb">
            <a lay-href="">主页</a>
            <a><cite>危险源管理</cite></a>
            <a><cite>编辑危险源管理</cite></a>
        </div>
    </div>

    <form method="post" class="layui-form">
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md6">
                    <div class="layui-card">
                        <div class="layui-card-header">危险源基础信息</div>
                        <div class="layui-card-body">

                            <div class="layui-form" wid100 lay-filter="">

                                <div class="layui-form-item">
                                    <label class="layui-form-label">危险源名称</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="send_nickname" value="" autocomplete="off"
                                            lay-verify="required" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux"></div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">设备类别</label>
                                    <div class="layui-input-block">
                                        <input type="checkbox" name="" title="消防">
                                        <input type="checkbox" name="" title="交通">
                                        <input type="checkbox" name="" title="环境">
                                        <input type="checkbox" name="" title="办公室">
                                        <input type="checkbox" name="" title="网络">
                                        <input type="checkbox" name="" title="其他">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux"></div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-col-lg6">
                                        <label class="layui-form-label">负责部门</label>
                                        <div class="layui-input-block">
                                            <input type="text" name="cache" value="" class="layui-input"
                                                placeholder="请输入负责部门" lay-verify="required">
                                        </div>

                                    </div>
                                    <div class="layui-col-lg6">
                                        <label class="layui-form-label">其他负责部门</label>
                                        <div class="layui-input-block">
                                            <select name="type" lay-verify="required" lay-filter="aihao">
                                                <option value="">==请选择==</option>
                                                <option value="0">部门一</option>
                                                <option value="1">部门二</option>
                                            </select>
                                        </div>

                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">可能性</label>
                                    <div class="layui-input-inline">

                                        <select name="type" lay-verify="required" lay-filter="aihao">
                                            <option value="">==请选择==</option>
                                            <option value="0">完全可以预料</option>
                                            <option value="1">相当可能</option>
                                            <option value="1">可能但不经常</option>
                                            <option value="1">可能性小，完全意外</option>
                                            <option value="1">很不可能，可以设想</option>
                                            <option value="1">极不可能</option>
                                            <option value="1">实际不可能</option>
                                        </select>

                                    </div>
                                    <div class="layui-form-mid layui-word-aux">事故发生的可能性</div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">危险程度</label>
                                    <div class="layui-input-inline">

                                        <select name="type" lay-verify="required" lay-filter="aihao">
                                            <option value="">==请选择==</option>
                                            <option value="0">连续暴露</option>
                                            <option value="1">每天工作时间暴露</option>
                                            <option value="1">每周一次或者偶尔暴露</option>
                                            <option value="1">每月一次暴露</option>
                                            <option value="1">每年几次暴露</option>
                                            <option value="1">非常罕见暴露</option>
                                        </select>

                                    </div>
                                    <div class="layui-form-mid layui-word-aux">暴露于危险环境的危险程度</div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">后果</label>
                                    <div class="layui-input-inline">

                                        <select name="type" lay-verify="required" lay-filter="aihao">
                                            <option value="">==请选择==</option>
                                            <option value="0">10人以上死亡</option>
                                            <option value="1">3-9人死亡</option>
                                            <option value="1">1-2人死亡</option>
                                            <option value="1">严重</option>
                                            <option value="1">重大，伤残</option>
                                            <option value="1">引人注意</option>
                                        </select>

                                    </div>
                                    <div class="layui-form-mid layui-word-aux">发生事故产生的后果</div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">风险等级</label>
                                    <div class="layui-input-inline">

                                        <select name="type" lay-verify="required" lay-filter="aihao">
                                            <option value="">==请选择==</option>
                                            <option value="0">
                                                <20稍有危险可以注意</option> <option value="1">20-70一般危险需要注意
                                            </option>
                                            <option value="1">70-160显著危险，需要整改</option>
                                            <option value="1">160-320 高度危险，需要立即整改</option>
                                            <option value="1">>320 极度危险不能继续作业</option>
                                        </select>

                                    </div>
                                    <div class="layui-form-mid layui-word-aux"></div>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
                <div class="layui-col-md6">
                    <div class="layui-card">
                        <div class="layui-card-header">危险源措施</div>
                        <div class="layui-card-body">

                            <div class="layui-form" wid100 lay-filter="">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">现有措施</label>
                                    <div class="layui-input-block">
                                        <textarea name="text" placeholder="请输入内容" class="layui-textarea"></textarea>
                                    </div>
                                    <div class="layui-form-mid layui-word-aux"></div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">增补措施</label>
                                    <div class="layui-input-block">
                                        <textarea name="text" placeholder="请输入内容" class="layui-textarea"></textarea>
                                    </div>
                                    <div class="layui-form-mid layui-word-aux"></div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">附件上传</label>
                                    <div class="layui-input-block">

                                        <div class="layui-upload">
                                            <button type="button" class="layui-btn layui-btn-danger"
                                                id="test-upload-testList"><i class="layui-icon"></i>选择多文件</button>
                                            <div class="layui-upload-list">
                                                <table class="layui-table">
                                                    <thead>
                                                        <tr>
                                                            <th>文件名</th>
                                                            <th>大小</th>
                                                            <th>状态</th>
                                                            <th>操作</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody id="test-upload-demoList"></tbody>
                                                </table>
                                            </div>
                                            <button type="button" class="layui-btn"
                                                id="test-upload-testListAction">开始上传</button>
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">辅助附件上传</div>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-layout-admin">
                <div class="layui-input-block">
                    <div class="layui-footer" style="left: 0;">
                        <button class="layui-btn" lay-submit="" id='btnOk' lay-filter="commit">保存</button>
                        <button type="button" class="layui-btn layui-btn-primary">重填</button>
                    </div>


                </div>
            </div>
        </div>
    </form>
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'upload'], function () {

            var $ = layui.jquery, form = layui.form
                , upload = layui.upload;

            //多文件列表示例
            var demoListView = $('#test-upload-demoList')
                , uploadListIns = upload.render({
                    elem: '#test-upload-testList'
                    , url: '/upload/'
                    , accept: 'file'
                    , multiple: true
                    , auto: false
                    , bindAction: '#test-upload-testListAction'
                    , choose: function (obj) {
                        var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
                        //读取本地文件
                        obj.preview(function (index, file, result) {
                            var tr = $(['<tr id="upload-' + index + '">'
                                , '<td>' + file.name + '</td>'
                                , '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
                                , '<td>等待上传</td>'
                                , '<td>'
                                , '<button class="layui-btn layui-btn-mini test-upload-demo-reload layui-hide">重传</button>'
                                , '<button class="layui-btn layui-btn-mini layui-btn-danger test-upload-demo-delete">删除</button>'
                                , '</td>'
                                , '</tr>'].join(''));

                            //单个重传
                            tr.find('.test-upload-demo-reload').on('click', function () {
                                obj.upload(index, file);
                            });

                            //删除
                            tr.find('.test-upload-demo-delete').on('click', function () {
                                delete files[index]; //删除对应的文件
                                tr.remove();
                                uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值，以免删除后出现同名文件不可选
                            });

                            demoListView.append(tr);
                        });
                    }
                    , done: function (res, index, upload) {
                        if (res.code == 0) { //上传成功
                            var tr = demoListView.find('tr#upload-' + index)
                                , tds = tr.children();
                            tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');
                            tds.eq(3).html(''); //清空操作
                            return delete this.files[index]; //删除文件队列已经上传成功的文件
                        }
                        this.error(index, upload);
                    }
                    , error: function (index, upload) {
                        var tr = demoListView.find('tr#upload-' + index)
                            , tds = tr.children();
                        tds.eq(2).html('<span style="color: #FF5722;">上传失败</span>');
                        tds.eq(3).find('.test-upload-demo-reload').removeClass('layui-hide'); //显示重传
                    }
                });

            form.on('submit(commit)', function (obj) {
                layer.msg('信息保存成功', { icon: 1, time: 1000 }, function () {
                    //location.href = '../../index.html'; //后台主页
                });
                return false;
            });
        });
    </script>
</body>

</html>